import React, {Component} from 'react'
import {Form, Select, Input,} from 'antd'
import PropTypes from 'prop-types'

const Item = Form.Item
const Option = Select.Option

class AddForm extends Component {

    static propTypes = {
        //用来传递form对象的函数
        setForm: PropTypes.func.isRequired,


    }

    componentWillMount() {
        this.props.setForm(this.props.form)
    }

    render() {

        const {getFieldDecorator} = this.props.form

        return (
            <Form>
                <Item label='角色名称'>
                    {
                        getFieldDecorator('roleName', {
                            initialValue: '',
                            rules: [
                                {required: true,message:'角色名称必须输入'}
                            ]
                        })(
                            <Input placeholder='请输入角色名称'/>
                        )
                    }
                </Item>
            </Form>
        )
    }
}


export default Form.create()(AddForm)